{extend name="base"}
{block name="title"}创建房间{/block}
{block name="head"}
<style>
  .border-table tbody th{text-align:center; color:#333; font-weight:400; padding-left:5px;}
  .border-table{font-size:12px; color:#666;}
  .border-table th, .border-table td{text-align:center; padding:0 4px;}
</style>
<script>
  $(function () {<!--在线房间点击KindID显示ServerID-->
    var KindID = $("#KindID").val();
    if (KindID != 0){
      $("#ServerID").attr('style','');
    }
  })
</script>
{/block}
{block name="body"}
<body class="mainbody">
<form>
  <!--导航栏-->
  <div class="location">
    <a href="javascript:history.back(-1);" class="back"><i class="iconfont icon-up"></i><span>返回上一页</span></a>
    <a href="{:url('index/home')}" class="home"><i class="iconfont icon-home"></i><span>首页</span></a>
    <i class="arrow iconfont icon-arrow-right"></i>
    <span>创建房间</span>
  </div>
  <!--/导航栏-->

  <!--工具栏-->
  <div id="floatHead" class="toolbar-wrap">
    <div class="toolbar">
      <div class="box-wrap">
        <a class="menu-btn"><i class="iconfont icon-more"></i></a>
        <div class="l-list">
          <div class="menu-list">
            <div class="rule-single-select">
              <select name="Channel" style="display:none">
                {volist name="CHANNELS" id="val"}
                <option value="{$key}"{eq name="Channel" value="$key"} selected{/eq}>[{$key}]{$val.Name}</option>
                {/volist}
              </select>
            </div>
            <div class="rule-single-select" >
              <select name="KindID" style="display:none" id="KindID">
                <option value="0">===所有游戏===</option>
                {volist name="GAME_KIND" id="v"}
                <option value="{$key}"{eq name="KindID" value="$key"} selected{/eq}>[{$key}]{$v}</option>
                {/volist}
              </select>
            </div>
            <div class="rule-single-select" id="ServerID" style="display: none;">
              <select name="ServerID" style="display:none">
                <option value="0">===所有游戏服务===</option>
                {volist name="SERVER" id="v"}
                <option value="{$key+1}"{eq name="ServerID" value="$key+1"} selected{/eq}>[{$v}]{$v}</option>
                {/volist}
              </select>
            </div>
            <div class="r-list">
              <label style="color:#c85e0b;">
                在线房间总数:{$NUM}
              </label>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!--/工具栏-->

  <!--列表-->
  <div class="table-container">
    <table class="ltable border-table">
      <tr>

        <th>渠道</th>
        <th>游戏名称</th>
        <th>游戏服务</th>
        <th>用户</th>
        <th>房号</th>
        <th>端口</th>
        <th>时间</th>
        <th>操作</th>
      </tr>
{empty name="list"}
      <tr><td colspan="10"><h1>Oh~{$error}!</h1></td></tr>
{else/}
      {volist name="list" id="v"}
      <tr>

        <td >[{$v.GameChannel}]{$CHANNELS[$v.GameChannel]['Name'] ?? '--'}</td>
        <td >[{$v.KindID}]{$GAME_KIND[$v.KindID]}</td>
        <td >[{$v.ServerID}]</td>
        <td class="user-avatar" title="
游戏帐号：{$USER_INFO[$v.OwnerID]['Accounts']}&#13
真实姓名：{$USER_INFO[$v.OwnerID]['Compellation']}&#13
身份证号：{$USER_INFO[$v.OwnerID]['PassPortID']}&#13
手机号码：{$USER_INFO[$v.OwnerID]['RegisterMobile']}&#13
注册时间：{$USER_INFO[$v.OwnerID]['RegisterDate']}&#13
注册地址：{$USER_INFO[$v.OwnerID]['RegisterIP']}&#13
登录次数：{$USER_INFO[$v.OwnerID]['GameLogonCount']} 次&#13
最后登录时间：{$USER_INFO[$v.OwnerID]['LastLogonDate']}&#13
最后登录地址：{$USER_INFO[$v.OwnerID]['LastLogonIP']}&#13
">
        <a target="_blank" href="{:url('user.detail/index')}?UserID={$v.OwnerID}">
          <img src="{$USER_INFO[$v.OwnerID]['AccountImgUrl']?:'__STATIC__/houtai/images/dface.png'}" />
        </a>
        <div class="user-box">
          <h4><a target="_blank" class="at_{$USER_INFO[$v.OwnerID]['AccountsType']}" href="{:url('user.detail/index')}?UserID={$v.OwnerID}">{:htmlentities($USER_INFO[$v.OwnerID]['NickName'])}</a></h4>
          <i>{$USER_INFO[$v.OwnerID]['GameID']}</i>
        </div>
        </td>
        <td ><a target="_blank" href="/user.game/index.html?RecordID=0&RoomID={$v.RoomId}">{$v.RoomId}</a></td>
        <td>{$v.AddrIp}</td>
        <td>{$v.CreateTimer}</td>
        <td><a href="javascript:;" roomid="{$v.RoomId}" server="{$v.ServerID}" kind="{$v.KindID}" chan="{$v.GameChannel}" class="del">强制解散</a></td>

      </tr>
      {/volist}
{/empty}
    </table>
  </div>
  <div style="text-align: center; margin-top: 10px;" >
    {$plistpage}
  </div>

  <!--/列表-->
</form>


<script>

    $(".del").click(function(){
        var channel = $(this).attr("chan");
        var kind = $(this).attr("kind");
        var roomid = $(this).attr("roomid");
        var server = $(this).attr("server");
        dialog({
        title: '提示',
        content: '确认强制解散[' + roomid + ']房间?',
        okValue: '确定',
        ok: function () {
          $.post("{:url('delroom')}", {
            Channel:channel,
            KindID:kind,
            RoomID:roomid,
            ServerID:server
          },function (resp, text, xhr) {
            // console.log(resp);
            if (resp.errno == 0) {
              location.reload();
            } else {
              alert(resp.error);
            }
          });
          return false;
        },
        cancelValue: '取消',
        cancel: function () {}
      }).showModal();
    })
</script>
</body>
{/block}